﻿<!DOCTYPE html>
<html>
<!-- 培训计划管理 -->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    <link href="/static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="/static/js/vue-treeselect/vue-treeselect.js"></script>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }

        .el-input__suffix {
            /* z-index: 9; */
        }
    </style>

</head>

<body>
    <div id="app" class="popupW100" v-cloak>
        <el-form label-position="right" :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="100px"
                 size="mini">
            <el-row>
                <!--年份-->
                <el-row>
                    <el-col :span="24">

                        <el-form-item prop="year">
                            <div class="elst-select-mini" style="margin-left: 0px">
                                {{'培训时间'+mark.m}}
                                <el-date-picker slot="suffix" v-model="Form.year" type="year" size="mini" format="yyyy"
                                                value-format="yyyy" placeholder="选择时间">
                                </el-date-picker>
                            </div>
                        </el-form-item>
                        <el-form-item prop="month">
                            <div class="elst-select-mini" style="margin-left: 0px">
                                <el-date-picker slot="suffix" v-model="Form.month" type="month" size="mini" format="MM"
                                                value-format="MM" placeholder="选择时间">
                                </el-date-picker>
                            </div>
                        </el-form-item>
                        <el-form-item prop="day">
                            <div class="elst-select-mini" style="margin-left: 0px">
                                <el-date-picker slot="suffix" v-model="Form.day" type="date" size="mini" format="dd"
                                                value-format="dd" placeholder="选择时间">
                                </el-date-picker>
                            </div>
                        </el-form-item>

                    </el-col>
                </el-row>
                <!--培训时间-->
                <el-row>
                    <el-col :span="11">
                        <el-form-item prop="trainingEndTime">
                            <div class="elst-select-mini" style="margin-left: 0px">
                                <el-input size="mini">
                                    <template slot="prepend">
                                        {{'结束时间'+mark.m}}
                                    </template>
                                    <el-date-picker slot="suffix" v-model="Form.trainingEndTime" type="date" size="mini"
                                                    format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                                    </el-date-picker>
                                </el-input>
                            </div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!--<el-col :span="11" offset="2">
        <el-col>
            <div class="elst-select-mini">
                <el-form-item>
                    <el-input size="mini">
                        <template slot="prepend">
                            <div> {{TrainingPlanManagement.post+mark.m}}</div>
                        </template>
                        <el-select @visible-change="visibleChange" v-model="Form.post" slot="suffix"
                            :placeholder="TrainingPlanManagement.post">
                            <el-option label="请选择" value=""></el-option>
                            <el-option v-for="item in postArray" :label="item.value" :value="item.key">
                            </el-option>
                        </el-select>
                    </el-input>
                </el-form-item>
            </div>
        </el-col>
    </el-col>-->
                <!--培训课程-->
                <el-row>
                    <el-col :span="11">
                        <div class="elst-select-mini">

                            <el-form-item prop="trainingcourse">
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{TrainingPlanManagement.trainingcourse+mark.m}}</div>
                                    </template>
                                    <el-select @change="onchangekc" @visible-change="visibleChange" v-model="Form.trainingcourse" slot="suffix">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in Courseware" :label="item.coursewareName" :value="item.id">
                                        </el-option>
                                    </el-select>
                                </el-input>
                                <span class="iputLineMust" v-if="!Form.trainingcourse">

                                    <img src="/static/images/exclamation.png" alt="">
                                </span>
                            </el-form-item>
                        </div>
                    </el-col>
                    <el-col :span="11" offset="2">
                        <div class="elst-select-mini">
                            <el-form-item>
                                <span>
                                    <label for="Trainingtime" class="el-form-item__label"
                                           style="width: 100px;">{{'培训课件'+mark.m}}</label>


                                    <btn-uploadfile-input text="导入课件" :fileid="Form.pX_Course.courseAttachment"
                                                          :filename="Form.pX_Course.attachmentName" :showdownload="true" ref="upbtn"
                                                          :showupload="false" @success="attachmentHandle"></btn-uploadfile-input>


                                </span>
                            </el-form-item>
                        </div>
                    </el-col>

                </el-row>

                <!--<el-col :span="4">
        <el-upload ref="Attachmentupload" action="/api/File/UpdateFile" multiple="true"
                   :on-preview="handlePreview" :on-remove="handleRemove"
                   :before-upload="CoursewareUploadbeforeupload" :auto-upload="true" :limit="1"
                   :show-file-list="false">
            <el-button class="ml10" type="primary" size="mini" @click="btnAttachmentUpload">
                {{col.btnImportcourseware}}
            </el-button>
        </el-upload>
    </el-col>-->
                <!--培训目标-->
                <el-row>
                    <el-col :span="24">
                        <div class="elst-select-mini">
                            <el-form-item prop="target">
                                <el-input type="text" v-model="Form.target" autocomplete="off" size="mini">
                                    <template slot="prepend">
                                        {{TrainingPlanManagement.Trainingobjectives+mark.m}}
                                    </template>
                                </el-input>
                                <span class="iputLineMust" v-if="!Form.target">
                                    <!-- 必填项添加 -->
                                    <img src="/static/images/exclamation.png" alt="">
                                </span>

                            </el-form-item>
                        </div>
                    </el-col>
                    <!--目标人群-->

                    <el-col :span="24">
                        <div class="elst-select-mini">
                            <!--<el-form-item prop="pX_PlanUser">
                    <div class="el-input--mini el-input-group">
                        <div class="el-input-group__prepend">
                            {{TrainingPlanManagement.objGroup+mark.m}}
                        </div>
                        <el-input class="el-textarea__inner" type="textarea" v-model="Form.pX_PlanUser"
                                  autocomplete="off"></el-input>
                    </div>

                    <span class="iputLineMust" v-if="!Form.pX_PlanUser">

                        <img src="/static/images/exclamation.png" alt="">
                    </span>
                </el-form-item>-->

                            <el-form-item prop="userIdList">
                                <div class="el-input--mini el-input-group">
                                    <div class="el-input-group__prepend">
                                        {{TrainingPlanManagement.objGroup+mark.m}}
                                    </div>
                                    <tree-department-staff class="el-textarea__inner" v-model="Form.userIdList"
                                                           :multiple="true" slot="suffix" style="line-height:14px;" placeholder="请选择" />
                                    <span class="iputLineMust" v-if="!Form.userIdList">
                                        <img src="/static/images/exclamation.png" alt="">
                                    </span>
                                </div>
                            </el-form-item>

                        </div>
                    </el-col>

                    <!--培训预算-->
                    <el-col :span="24">
                        <div class="elst-select-mini">
                            <el-form-item prop="trainingbudget">
                                <el-input type="text" v-model="Form.trainingbudget" autocomplete="off" size="mini">
                                    <template slot="prepend">
                                        {{TrainingPlanManagement.Trainingbudget+mark.m}}
                                    </template>
                                </el-input>

                                <span class="iputLineMust" v-if="!Form.trainingbudget">
                                    <!-- 必填项添加 -->
                                    <img src="/static/images/exclamation.png" alt="">
                                </span>
                            </el-form-item>
                        </div>
                    </el-col>
                    <!--培训讲师-->
                    <el-col :span="24">
                        <div class="elst-select-mini">
                            <!--<el-form-item prop="trainer">
                    <el-input type="text" v-model="Form.trainer" autocomplete="off" size="mini">
                        <template slot="prepend">
                            {{TrainingPlanManagement.Trainer+mark.m}}
                        </template>
                    </el-input>
                    <span class="iputLineMust" v-if="!Form.trainer">

                        <img src="/static/images/exclamation.png" alt="">
                    </span>
                </el-form-item>-->

                            <el-form-item prop="trainer">
                                <div class="el-input--mini el-input-group">
                                    <div class="el-input-group__prepend">
                                        {{TrainingPlanManagement.Trainer+mark.m}}
                                    </div>
                                    <tree-department-staff-single class="el-textarea__inner" v-model="Form.trainer"
                                                                  slot="suffix" style="line-height:28px;" placeholder="请选择" />
                                    <span class="iputLineMust" v-if="!Form.trainer">
                                        <img src="/static/images/exclamation.png" alt="">
                                    </span>
                                </div>
                            </el-form-item>
                        </div>
                    </el-col>

                    <!--<el-col :span="4">
            <el-button type="primary" @click="addTrainer" class="ml10">
                {{col.btnSelectionTeachers}}
            </el-button>
        </el-col>-->
                    <!--掌握程度-->
                    <el-col :span="11">
                        <el-col>
                            <div class="elst-select-mini">
                                <el-form-item prop="masteryLevel">
                                    <el-input size="mini">
                                        i"
                                        <template slot="prepend">
                                            <div> {{TrainingPlanManagement.mastery+mark.m}}</div>
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="Form.masteryLevel" slot="suffix"
                                                   :placeholder="TrainingPlanManagement.mastery">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in mastery" :label="item.value" :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>

                                    <span class="iputLineMust" v-if="!Form.masteryLevel">
                                        <!-- 必填项添加 -->
                                        <img src="/static/images/exclamation.png" alt="">
                                    </span>

                                </el-form-item>
                            </div>
                        </el-col>
                    </el-col>
                    <!--培训方式-->
                    <el-col :span="11" :offset="2">
                        <el-col>
                            <div class="elst-select-mini">
                                <el-form-item prop="trainingmethods">
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            <div> {{TrainingPlanManagement.Trainingmethods+mark.m}}</div>
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="Form.trainingmethods" slot="suffix"
                                                   :placeholder="TrainingPlanManagement.Trainingmethods">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in Trainingmethods" :label="item.value"
                                                       :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>

                                    <span class="iputLineMust" v-if="!Form.trainingmethods">
                                        <!-- 必填项添加 -->
                                        <img src="/static/images/exclamation.png" alt="">
                                    </span>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-col>
                    <!--培训内容-->

                    <el-col :span="24">
                        <div class="elst-select-mini">
                            <el-form-item prop="trainingcontent">
                                <div class="el-input--mini el-input-group">
                                    <div class="el-input-group__prepend">
                                        {{TrainingPlanManagement.Trainingcontent+mark.m}}
                                    </div>
                                    <el-input class="el-textarea__inner" type="textarea" v-model="Form.trainingcontent"
                                              autocomplete="off"></el-input>
                                </div>
                                <span class="iputLineMust" v-if="!Form.trainingcontent">
                                    <!-- 必填项添加 -->
                                    <img src="/static/images/exclamation.png" alt="">
                                </span>
                            </el-form-item>
                        </div>
                    </el-col>

                </el-row>

                <el-col :span="24">
                    <div class="head-tool el-col el-col-24">考试信息</div>
                </el-col>
                <el-row>
                    <el-col :span="11">
                        <el-col>
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.examinationmethods">
                                    <el-input size="mini">
                                        e
                                        <template slot="prepend">
                                            <div> {{TrainingPlanManagement.Examinationmethods+mark.m}}</div>
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="Form.pX_Exam.examinationmethods" slot="suffix" @change="onchange"
                                                   :placeholder="TrainingPlanManagement.Examinationmethods">
                                            <!--<el-option label="请选择" value=""></el-option>-->
                                            <el-option v-for="item in Examinationmethods" :label="item.value"
                                                       :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-col>
                </el-row>
                <div v-show="visible">
                    <el-row>
                        <el-col :span="11">
                            <el-col>
                                <div class="elst-select-mini">
                                    <el-form-item prop="pX_Exam.facilityvalue" ref="pX_Exam.facilityvalue">
                                        <el-input size="mini">
                                            <template slot="prepend">
                                                <div> {{TrainingPlanManagement.facilityvalue+mark.m}}</div>
                                            </template>
                                            <el-select @visible-change="visibleChange" v-model="Form.pX_Exam.facilityvalue" slot="suffix"
                                                       :placeholder="TrainingPlanManagement.facilityvalue">
                                                <!--<el-option label="请选择" value=""></el-option>-->
                                                <el-option v-for="item in facilityvalue" :label="item.value" :value="item.key">
                                                </el-option>
                                            </el-select>
                                        </el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!--<el-col :span="11" offset="2">
                <el-col>
                    <div class="elst-select-mini">
                        <el-form-item prop="pX_Exam.examinationmethods">
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{TrainingPlanManagement.Questiontype+mark.m}}</div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="Form.Questiontype" slot="suffix"
                                           :placeholder="TrainingPlanManagement.Questiontype">

                                    <el-option v-for="item in Questiontype" :label="item.value" :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-col>-->
                        <el-col :span="11">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.fullmarks" ref="pX_Exam.fullmarks">
                                    <el-input type="text" v-model="Form.pX_Exam.fullmarks" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.Fullmarks+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="11" offset="2">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.qualificationscore" ref="pX_Exam.qualificationscore">
                                    <el-input type="text" v-model="Form.pX_Exam.qualificationscore" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.Qualificationscore+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="11">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.judgmentNumber">
                                    <el-input type="text" v-model="Form.pX_Exam.judgmentNumber" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.JudgmentQuestion+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="11" offset="2">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.judgmentScore">
                                    <el-input type="text" v-model="Form.pX_Exam.judgmentScore" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.Scoresforeachquestion1+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="11">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.singleNumber">
                                    <el-input type="text" v-model="Form.pX_Exam.singleNumber" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.Singlechoicetopic+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="11" offset="2">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.singleScore">
                                    <el-input type="text" v-model="Form.pX_Exam.singleScore" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.Scoresforeachquestion2+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="11">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.multipleNumber">
                                    <el-input type="text" v-model="Form.pX_Exam.multipleNumber" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.Multipletopics+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="11" offset="2">
                            <div class="elst-select-mini">
                                <el-form-item prop="pX_Exam.multipleScore">
                                    <el-input type="text" v-model="Form.pX_Exam.multipleScore" autocomplete="off" size="mini">
                                        <template slot="prepend">
                                            {{TrainingPlanManagement.Scoresforeachquestion3+mark.m}}
                                        </template>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>

                        <!--<el-col :span="11">
                <el-form-item>
                    <div class="elst-select-mini" style="margin-left: 0px">
                        <el-input size="mini">
                            <template slot="prepend">
                                {{TrainingPlanManagement.Examinationstarttime+mark.m}}
                            </template>
                            <el-date-picker slot="suffix" v-model="Form.Examinationstarttime" type="date"
                                            size="mini" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                            </el-date-picker>
                        </el-input>
                    </div>
                </el-form-item>
            </el-col>
            <el-col :span="11" offset="2">
                <el-form-item>
                    <div class="elst-select-mini" style="margin-left: 0px">
                        <el-input size="mini">
                            <template slot="prepend">
                                {{TrainingPlanManagement.Endtimeofexamination+mark.m}}
                            </template>
                            <el-date-picker slot="suffix" v-model="Form.Endtimeofexamination" type="date"
                                            size="mini" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                            </el-date-picker>
                        </el-input>
                    </div>
                </el-form-item>
            </el-col>-->
                    </el-row>
                </div>

                <div v-if="this.id&&Form.state!=0">
                    <el-col :span="24">
                        <div class="head-tool el-col el-col-24">附件信息</div>
                    </el-col>
                    <el-col :span="24">
                        <el-upload name="files" class="fl" ref="Attachmentupload" :data="{data:this.id}" action="/api/File/UploadFileForPXPlan" multiple="false"
                                   :on-success="successUpLoad" :auto-upload="true" :limit="1"
                                   :show-file-list="false">
                            <el-button style="margin: 10px;" type="primary" size="mini" @click="btnAttachmentUpload">
                                {{col.btnUpLoad}}
                            </el-button>
                            <!--<el-button type="primary">{{col.btnUpLoad}}</el-button>-->
                        </el-upload>
                    </el-col>
                    <el-col :span="24">
                        <el-table ref="table" stripe :data="Form.pX_SignDetail" :row-key="getRowKeys" :height="ListItem.tableHeight"
                                  border @selection-change="handleSelectionChange" row-style="height:10px"
                                  style="width: 100%;height: 100%;">
                            <el-table-column prop="remark" :label="'附件名称'" min-width="200">
                            </el-table-column>
                            <el-table-column prop="createTime" :label="'添加时间'" min-width="200">
                            </el-table-column>
                            <el-table-column width="110" :label="'删除'" fixed="right">
                                <template slot-scope="scope">

                                    <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                                        <i class="el-icon-edit"></i>
                                    </button>
                                </template>
                            </el-table-column>
                            <el-table-column width="110" :label="'下载'" fixed="right">
                                <template slot-scope="scope">

                                    <a  :href="downLoadUrl(scope.row.deptID)">下载</a>
                                 </template>
                            </el-table-column>
                            
                        </el-table>
                    </el-col>

                </div>
            </el-row>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <!--<el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>-->
                    <el-button v-if="Form.state=='0' || Form.id==guidEmpty" type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  -->
        <el-dialog :title="title" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog'
                   width="80%" height="80%" top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:100%;width:100%" frameborder="0"></iframe>
        </el-dialog>

    </div>
    <script type="text/javascript">
        var uploadText = "请选择上传文件";
        var app = new Vue({
            el: '#app',
            data: {
                //父业传参
                uploadlist:[],
                id: '',
                title: '',
                imageUrl: '',
                visible: true,
                value1: '',
                radio: '1',
                ListItem: ListItem,
                postArray: [],
                TrainingMatrix: [],
                mastery: [],//掌握程度
                Trainingmethods: [],
                facilityvalue: [],
                Questiontype: [],
                Examinationmethods: [],
                Courseware: [],
                formInline: {
                    model: {
                        PersonnelName: '',
                        Subordinatedepartments: '',
                        Nameofcertificate: '',
                        Issuancetime: '',
                        Maturitytime: '',
                        Certificatetype: '',
                        LicenseCoding: '',
                        Licensingauthority: '',
                        Termofvalidity: '',
                        Trainer: ''
                    },
                    offset: 0,
                    limit: 10
                },
                //业务表单内容
                Form: {
                    pX_Exam: {
                        
                        fullmarks: '0',
                        qualificationscore: '0',
                        judgmentNumber: '0',
                        judgmentScore: '0',
                        singleNumber: '0',
                        singleScore: '0',
                        multipleNumber: '0',
                        multipleScore: '0',
                        
                    },
                    pX_Course: {},
                    userIdList: null,
                    id: guidEmpty,
                    Trainingtime: '',
                    trainingcourse: null,
                    Trainingvenues: '',
                    Typesoftraining: '',
                    Trainingcontent: '',
                    state: '',
                    pX_PlanUser:[],
                    Trainer: '',
                    HeadofTraining: '',
                    Nameoftrainingplan: '',
                    TrainingMatrix: '',
                    Trainingbudget: '',
                    mastery: '',//掌握程度
                    Trainingmethods: '',
                    Trainers: [],
                    facilityvalue: '',
                    Questiontype: '',
                    fullmarks: '',
                    Qualificationscore: '',
                    JudgmentQuestion: '',
                    Scoresforeachquestion1: '',
                    Singlechoicetopic: '',
                    Scoresforeachquestion2: '',
                    Multipletopics: '',
                    Scoresforeachquestion3: '',
                    Examinationstarttime: '',
                    Endtimeofexamination: '',
                    Examinationmethods: '',

                    Trainingobjectives: '',//培训目标
                },
                //表单验证
                rules: {
                    year: [
                        verification.NotNull,
                    ],
                    month: [
                        verification.NotNull,
                    ],
                    day: [
                        verification.NotNull,
                    ],
                    trainingEndTime: [
                        verification.NotNull,
                    ],
                    trainingcourse: [
                        verification.NotNull,
                    ],
                    userIdList: [
                        verification.NotNull
                    ],
                    target: [
                        verification.NotNull
                    ],
                    pX_PlanUser: [
                        verification.NotNull
                    ],
                    trainingbudget: [
                        verification.NotNull,
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
                    ],
                    trainer: [
                        verification.NotNull
                    ],
                    masteryLevel: [
                        verification.NotNull
                    ],
                    trainingmethods: [
                        verification.NotNull
                    ],
                    trainingcontent: [
                        verification.NotNull
                    ],
                    'pX_Exam.examinationmethods': [
                        verification.NotNull
                    ],
                    'pX_Exam.facilityvalue': [
                        verification.NotNull
                    ],
                    'pX_Exam.fullmarks': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
                        verification.NotNull
                    ],
                    'pX_Exam.qualificationscore': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
                        verification.NotNull
                    ],
                    'pX_Exam.judgmentNumber': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
                       
                    ],
                    'pX_Exam.judgmentScore': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
             
                    ],
                    'pX_Exam.singleNumber': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
                 
                    ],
                    'pX_Exam.singleScore': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
             
                    ],
                    'pX_Exam.multipleNumber': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
                 
                    ],
                    'pX_Exam.multipleScore': [
                        { pattern: verification.IsDecimal.t, message: verification.IsDecimal.m },
        
                    ],
                }
            },

            methods: {
                successUpLoad: function (res, file) {
                    showMessage(msg.OperatingOk, "success");
                    this.getData();
                },

                btnAttachmentUpload: function (file) {
                    //若更换文件则将文件名字更换触发条件--先删除上一个文件,后添加一个文件
                    if (this.fileAttachmentUpload != uploadText) {
                        this.$refs.Attachmentupload.clearFiles();
                        this.fileAttachmentUpload = file.name;
                    }
                    else {

                    }
                    this.$refs.Attachmentupload.submit();
                },

                attachmentHandle: function (response, fileid, fileName) {

                    this.Form.pX_Course.courseAttachment = fileid;
                    this.Form.pX_Course.attachmentName = fileName;

                },
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                onchange: function (val) {

                    if (val != "" && val == 0)
                        this.visible = true;
                    else
                        this.visible = false;

                },
                onchangekc: function (val) {
                    var mythis = this;
                    //课程id修改
                    myAjax("get", mythis, '/api/PX_Plan/GetCourse?id=' + val, null, function (response) {
                        var ajaxModel = response.data;
                        
                        mythis.Form.trainingcourse = ajaxModel.trainingcourse;
                        mythis.Form.pdnum = ajaxModel.pdnum;
                        mythis.Form.duoxnum = ajaxModel.duoxnum;
                        mythis.Form.danxnum = ajaxModel.danxnum;
                        mythis.Form.pX_Course.courseAttachment = ajaxModel.courseAttachment;
                        mythis.Form.pX_Course.attachmentName = ajaxModel.attachmentName;
                        mythis.Form.userIdList = ajaxModel.userlist;
                        mythis.Form.trainer = ajaxModel.trainer;

                    }, false);

                    //课件修改

                },
                handleRemove: function (file) {
                    console.log(file);
                },
                handlePreview: function (file) {
                    console.log(file.name);
                    window.open(file.url)
                },
                //上传附件文件的校验
                CoursewareUploadbeforeupload: function (file) {
                    var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
                    //将附件名赋值到label上
                    this.Form.trainingcourse = file.name;
                    const extension = testmsg === 'doc'
                    const extension2 = testmsg === 'pdf'
                    const isLt10M = file.size / 1024 / 1024 < 10
                    if (!extension && !extension2) {
                        this.$message({
                            message: '上传文件只能是 doc、pdf格式!',
                            type: 'warning'
                        });
                    }
                    if (!isLt10M) {
                        this.$message({
                            message: '上传文件大小不能超过 10MB!',
                            type: 'warning'
                        });
                    }
                    if (extension || extension2 && isLt10M)
                        submitUpload(this, 'upload')
                    return extension || extension2 && isLt10M
                },
                btnAttachmentUpload: function () {
                    //若更换文件则将文件名字更换触发条件--先删除上一个文件,后添加一个文件
                    if (this.fileAttachmentUpload != uploadText) {
                        this.$refs.Attachmentupload.clearFiles();
                        this.fileAttachmentUpload = file.name;
                    }
                    else {

                    }
                    this.$refs.Attachmentupload.submit();
                },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/TrainingPlanManagement/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                btnUpLoad: function () {
                    this.$message({
                        message: '上传成功',
                        type: 'success'
                    });
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    
                    //判断考试是否为线上 如果不是  去除验证
                    if (mythis.Form.pX_Exam.examinationmethods != "0") {
                        mythis.$refs['pX_Exam.facilityvalue'].prop = '';
                        mythis.$refs['pX_Exam.fullmarks'].prop = '';
                        mythis.$refs['pX_Exam.qualificationscore'].prop = '';
                       

                    }
                    else {

                        mythis.$refs['pX_Exam.facilityvalue'].prop = 'pX_Exam.facilityvalue';
                        mythis.$refs['pX_Exam.fullmarks'].prop = 'pX_Exam.fullmarks';
                        mythis.$refs['pX_Exam.qualificationscore'].prop = 'pX_Exam.qualificationscore';
                       
                    }


                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            //years month day 获取时间
                            //计划开始时间拼接
                            mythis.Form.trainingBeginTime = mythis.Form.year + '-' + mythis.Form.month + '-' + mythis.Form.day;

                            if (mythis.Form.trainingBeginTime > mythis.Form.trainingEndTime) {
                                showMessage('培训开始时间需要小于培训结束时间！', 'error');
                                return false;

                            }
                            //如果为线上考试 验证 题目是否够用
                            if (mythis.Form.pX_Exam.examinationmethods == "0") {
                                if (mythis.Form.pX_Exam.fullmarks - mythis.Form.pX_Exam.qualificationscore < 0) {
                                    showMessage('合格分数不能大于满分！', 'error');
                                    return false;

                                }

                                if (mythis.Form.pX_Exam.judgmentNumber && mythis.Form.pX_Exam.judgmentNumber > mythis.Form.pdnum) {

                                    showMessage('系统中判断题的数量不够！', 'error');
                                    return false;
                                }

                                if (mythis.Form.pX_Exam.singleNumber && mythis.Form.pX_Exam.singleNumber > mythis.Form.danxnum) {

                                    showMessage('系统中单选题的数量不够！', 'error');
                                    return false;
                                }

                                if (mythis.Form.pX_Exam.multipleNumber && mythis.Form.pX_Exam.multipleNumber > mythis.Form.duoxnum) {

                                    showMessage('系统中多选题的数量不够！', 'error');
                                    return false;
                                }
                                mythis.Form.status = 0;
                                //验证总分是否为 满分
                                
                                var sum = 0;
                                if (mythis.Form.pX_Exam.judgmentNumber && mythis.Form.pX_Exam.judgmentScore) {
                                    sum += mythis.Form.pX_Exam.judgmentNumber * mythis.Form.pX_Exam.judgmentScore;
                                }
                                if (mythis.Form.pX_Exam.singleNumber && mythis.Form.pX_Exam.singleScore) {
                                    sum += mythis.Form.pX_Exam.singleNumber * mythis.Form.pX_Exam.singleScore;
                                }
                                if (mythis.Form.pX_Exam.multipleNumber && mythis.Form.pX_Exam.multipleScore) {
                                    sum += mythis.Form.pX_Exam.multipleNumber * mythis.Form.pX_Exam.multipleScore;
                                }
                                if (sum != mythis.Form.pX_Exam.fullmarks) {

                                    showMessage('设置的试题与分数与总分不符！', 'error');
                                    return false;
                                }

                                if (mythis.Form.pX_Exam.judgmentNumber == null) {
                                    mythis.Form.pX_Exam.judgmentNumber = 0;
                                }
                                if (mythis.Form.pX_Exam.singleNumber == null) {
                                    mythis.Form.pX_Exam.singleNumber = 0;
                                }
                                if (mythis.Form.pX_Exam.multipleNumber == null) {
                                    mythis.Form.pX_Exam.multipleNumber = 0;
                                }

                            }

                            mythis.Form.state = 0;
                            

                           
                            onSubmitForm(this, '/api/PX_Plan/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getData: function () {
                    var mythis = this;

                    if (mythis.id != null && mythis.id != '') {
                        myAjax("get", mythis, '/api/PX_Plan/PCGet?id=' + this.id, null, function (response) {
                            var ajaxModel = response.data;
                          
                            mythis.Form = ajaxModel;
                            mythis.Form.pX_Exam.fullmarks = mythis.Form.pX_Exam.fullmarks + "";
                            mythis.Form.pX_Exam.qualificationscore = mythis.Form.pX_Exam.qualificationscore + "";
                            mythis.Form.pX_Exam.judgmentNumber = mythis.Form.pX_Exam.judgmentNumber + "";
                            mythis.Form.pX_Exam.judgmentScore = mythis.Form.pX_Exam.judgmentScore + "";
                            mythis.Form.pX_Exam.singleNumber = mythis.Form.pX_Exam.singleNumber + "";
                            mythis.Form.pX_Exam.singleScore = mythis.Form.pX_Exam.singleScore + "";
                            mythis.Form.pX_Exam.multipleNumber = mythis.Form.pX_Exam.multipleNumber + "";
                            mythis.Form.pX_Exam.multipleScore = mythis.Form.pX_Exam.multipleScore + "";


                            if (mythis.Form.pX_Exam.examinationmethods != "0") {
                                mythis.visible = false;
                            }

                        }, false);

                    } else {
                        mythis.visible = false;

                    }


                },

                //删除方法
                onDelete: function () { onDelete(this, '/api/PX_Plan/DeleteMuti'); },
                UserInput: function (val, id) {
                    var mythis = this;
                    mythis.$confirm(' 是否确认继续?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(function () {
                        //console.log(123)
                        var delIds = [];
                        
                        delIds.push(id);
                        
                        myAjax("post", mythis, '/api/PX_SignDetail/DeleteMuti', delIds, function (response) {
                            mythis.getData();
                            showMessage(msg.OperatingOk, "success");
                        });
                    }).catch(function () {
                        showMessage("已取消删除!");
                    });

                },

                //列表选择触发
                UserInputStatistics: function (val, id) { DialogShow(this, val, "TrainingPlanManagementInputPerson.html", id); },
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/PX_Plan/GetList') },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                addTrainer: function (val, id) {
                    this.title = '选择培训老师';
                    DialogShow(this, val, "TrainingPlanManagementluruInputTrainer.html", id);
                },
                //addTrainers: function (val, id) {
                //    this.title = '选择培训人员';
                //    DialogShow(this, val, "TrainingPlanManagementluruInputTrainers.html", id);
                //},
                addTrainers: function (val, id) {
                    this.title = '选择目标人群';
                    DialogShow(this, val, "TrainingPlanManagementluruInputTrainers.html", id);
                },
            },
            mounted: function () {
                //初始化数据
                //this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
                this.id = getUrlParam("id");
                var mythis = this;
                myAjax("post", this, '/api/PX_Course/GetListForDropDown', {
                    limit: 10,
                    model: { createFactory: parent.app.formInline.model.createFactory },offset: 0
                }, function (response) {
                    mythis.Courseware = response.data.pageData;
                }, false);
                this.getData();
                //获取下拉菜单内容
                //this.TrainingMatrix = getDicData('技能要求');
                this.Trainingmethods = getDicData('w64');//培训方式
                this.facilityvalue = getDicData('题目等级');
                this.Questiontype = getDicData('题目类型');
                this.Examinationmethods = getDicData('w64');
                //this.postArray = getDicData('技能要求');//岗位
                this.mastery = getDicData('技能要求');//掌握程度
            }

        });
    </script>
</body>

</html>